package com.cqjtu.education.service.impl;

import com.cqjtu.education.entity.InboxRecipent;
import com.cqjtu.education.dao.InboxRecipentDao;
import com.cqjtu.education.service.InboxRecipentService;
import com.github.pagehelper.Page;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * (InboxRecipent)表服务实现类
 *
 * @author makejava
 * @since 2022-04-20 15:48:54
 */
@Service("inboxRecipentService")
public class InboxRecipentServiceImpl implements InboxRecipentService {
    @Resource
    private InboxRecipentDao inboxRecipentDao;

    /**
     * 通过ID查询单条数据
     *
     * @param inboxId 主键
     * @return 实例对象
     */
    @Override
    public InboxRecipent queryById(String inboxId) {
        return this.inboxRecipentDao.queryById(inboxId);
    }


    /**
     * 新增数据
     *
     * @param inboxRecipent 实例对象
     * @return 实例对象
     */
    @Override
    public InboxRecipent insert(InboxRecipent inboxRecipent) {
        this.inboxRecipentDao.insert(inboxRecipent);
        return inboxRecipent;
    }

    /**
     * 修改数据
     *
     * @param inboxRecipent 实例对象
     * @return 实例对象
     */
    @Override
    public InboxRecipent update(InboxRecipent inboxRecipent) {
        this.inboxRecipentDao.update(inboxRecipent);
        return this.queryById(inboxRecipent.getInboxId());
    }

    /**
     * 通过主键删除数据
     *
     * @param inboxId 主键
     * @return 是否成功
     */
    @Override
    public boolean deleteById(String inboxId) {
        return this.inboxRecipentDao.deleteById(inboxId) > 0;
    }
}
